package com.eaoa.uc.permission.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.uc.permission.bo.RoleAddAccountBO;
import com.stony.core.util.CoreUtils;

public class AddRoleEmployeeAction extends EABaseAction {

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		Long roleno = CoreUtils.parseLong(request.getParameter("roleno"));
		Long accountno = CoreUtils.parseLong(request.getParameter("accountno"));

		if(accountno!=null && roleno!=null){
			List rolenos = new ArrayList();
			rolenos.add(roleno);
			RoleAddAccountBO bo = new RoleAddAccountBO(accountno, rolenos);
			bo.execute();
		}

		request.setAttribute("roleno", roleno);

		return mapping.findForward("success");
	}

}
